<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8" />
    <title>07_IIFE-使用场景</title>
</head>

<body>
    <script>

        (function () {
            var a = 2;

            function f1() {
                console.log(a);
            }

            f1();

            function f2() {
                console.log(a);
            }

            f2();

        })();

        (function(){
            (function(){
                var a = 111;
                console.log(a);
            })();

            (function(){
                var a = 2222;
                console.log(a);
            })();
        })();

        // console.log(a);

    </script>
</body>

</html>